<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'

import type { WorkItem } from '@/types/Works'

const { tm } = useI18n()

const opusData = computed<WorkItem[]>(() => tm('works'))
</script>

<template>
  <div class="opus-box">
    <div class="gap"></div>
    <section class="opus-chunk" v-for="item in opusData" :key="item.companyName">
      <div class="name">{{ item.companyName }}</div>
      <div class="company-header">
        <span class="title">{{ item.title }}</span>
        <span class="time number">{{ item.timeGap }}</span>
      </div>
      <div class="merit-box">
        <div class="merit-item">
          <div class="merit-label">工作内容</div>
          <ul class="merit-content">
            <li v-for="(i, j) in item.workContent" :key="j">{{ i }}</li>
          </ul>
        </div>
        <div class="merit-item">
          <span class="merit-label">工作业绩</span>
          <ul class="merit-content">
            <li v-for="(i, j) in item.workMerit" :key="j">{{ i }}</li>
          </ul>
        </div>
      </div>
    </section>
  </div>
</template>

<style scoped lang="scss">
.opus-box {
  .opus-chunk {
    width: 100%;
    padding: 30px 25px;
    background: var(--side-color);
    border-radius: 8px;
    margin-bottom: 15px;

    &:last-child {
      border-bottom: 0;
    }
    .name {
      font-weight: bold;
      font-size: 16px;
    }
    .company-header {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      margin: 6px 0;
      justify-content: flex-start;
      font-size: 13px;
      font-weight: bold;

      .title {
        color: var(--sub-color);
      }
      .time {
        color: var(--sub-color);
        transform: scale(0.9);
        text-align: right;
        font-size: 14px;
      }
    }
    .merit-box {
      padding: 25px 12px;
      margin-top: 12px;
      border-radius: 5px;
      background-color: var(--side-color-2);
      .merit-item {
        margin-bottom: 6px;
        font-size: 14px;
        letter-spacing: 1px;
        .merit-label {
          font-weight: bold;
          flex-shrink: 0;
          width: 80px;
          font-size: 13px;
        }
        .merit-content {
          padding: 8px 20px;
          margin-left: 12px;
          flex: 1;
        }
      }
    }
  }
}
</style>
